﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using OneRed.Main.Pages;
using SkiaSharp;
using Index = OneRed.Main.Pages.Index;

namespace OneRed.Main.Comm
{
    public class ChageMapPropertis
    {
        public async Task EdgeChage(int TabIndex, Color color, double dAlpha = 0.8, bool blOnlyColor = false, bool blLarge = true)
        {
            //如果TabIndex==0则为基本图形
            if (TabIndex == 0)
            {
                int i = 2;
                if (blOnlyColor)
                    i = 0;
                else
                {
                    if (blLarge)
                        i = 2;
                    else
                        i = -1 * i;

                }
                var vbyte =Math.Round(255 * dAlpha);
                SKColor drawingColor = new SKColor(color.R, color.G, color.B, (byte)vbyte);
                await Index.lvc.ChageEdgeStroke(i, drawingColor);
            }
        }

        public async Task LabelChage(int TabIndex, Color color, double dAlpha = 0.8, bool blOnlyColor = false, bool blLarge = true)
        {
            //如果TabIndex==0则为基本图形
            if (TabIndex == 0)
            {
                int i = 2;
                if (blOnlyColor)
                    i = 0;
                else
                {
                    if (blLarge)
                        i = 2;
                    else
                        i = -1 * i;

                }
                var vbyte = (byte)(255 * dAlpha);
                SKColor drawingColor = new SKColor(color.R, color.G, color.B, vbyte);
                await Index.lvc.ChageLabelStroke(i, drawingColor);
            }
        }
        public async Task NodeChage(int TabIndex, Color color, double dAlpha = 0.8, bool blOnlyColor = false, bool blLarge = true)
        {
            //如果TabIndex==0则为基本图形
            if (TabIndex == 0)
            {
                int i = 2;
                if (blOnlyColor)
                    i = 0;
                else
                {
                    if (blLarge)
                        i = 2;
                    else
                        i = -1 * i;

                }
                var vbyte = Math.Round(255 * dAlpha);
                SKColor drawingColor = new SKColor(color.R, color.G, color.B, (byte)vbyte);
                await Index.lvc.ChageNodeStroke(i, drawingColor);
            }
        }
    }
}
